package com.naiterui.ehp.bs.consult.feign;

import com.naiterui.ehp.bp.bo.patient.MsgMaPublishParamBO;
import com.naiterui.ehp.bp.bo.patient.MsgPublishBO;
import com.naiterui.ehp.bp.bo.patient.MsgPublishParamBO;
import com.naiterui.ehp.bp.bo.patient.PatientInquirerBO;
import com.naiterui.ehp.bp.support.config.FeignConfiguration;
import com.naiterui.ehp.bp.support.exception.BusinessException;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.scheduling.annotation.Async;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;

import java.util.List;

/**
 * 患者客服消息
 *
 * @author yangfuya
 * @version 1.0
 * @date 2021-02-27 11:28
 **/
@FeignClient(name = "apFeignClient", url = "${ehp.domain.ap}", configuration = FeignConfiguration.class)
public interface ApFeignClient {

    int PATIENT_PUSH_PLATFORMID = 2;
    int PATIENT_PUSH_TEMPLATED_RECOMMEND_NOT_ORDER = 5;
    int PATIENT_PUSH_TEMPLATED_SESSION_FINISH = 6;

    /**
     * 发送客服消息
     *
     * @param openId  openid
     * @param content 发送内容
     */
    @PostMapping("inner/custom/sendSystemMsg")
    void sendSystemMsg(@RequestParam("openId") String openId, @RequestParam("content") String content);

    @Async
    @RequestMapping("inner/push")
    void patientPush(@RequestParam("platformId") Integer platformId, @RequestParam("templateId") Integer templateId, @RequestParam("paramData") String paramDate);

    /**
     * 发送客服消息--小程序卡片
     *
     * @param openId       openid
     * @param title        发送内容
     * @param appId        小程序appid
     * @param pagePath     小程序路径
     * @param thumbMediaId 永久素材id
     */
    @PostMapping("inner/custom/sendMiniProgramMsg")
    void sendMiniProgramMsg(@RequestParam("openId") String openId,
                            @RequestParam("title") String title,
                            @RequestParam("appId") String appId,
                            @RequestParam("pagePath") String pagePath,
                            @RequestParam("thumbMediaId") String thumbMediaId);


    /**
     * 上传素材
     *
     * @param filePath 文件路径
     * @return 素材id
     */
    @PostMapping("inner/custom/uploadThumbMedia")
    String uploadThumbMedia(@RequestParam("filePath") String filePath);

    /**
     * 获取就诊人信息
     *
     * @param inquirerIds
     * @return
     * @throws BusinessException
     */
    @PostMapping("inner/patient/inquirer/list")
    List<PatientInquirerBO> getPatientInquirer(@RequestBody List<Long> inquirerIds) throws BusinessException;

    /**
     * 推送消息
     * @param publishParamBO
     * @return
     */
    @PostMapping("/inner/message/publish")
    MsgPublishBO publishMessage(@RequestBody MsgPublishParamBO publishParamBO);

    /**
     * 小程序消息
     * @param publishParamBO
     * @return
     */
    @Async
    @PostMapping("/inner/message/ma/publish")
    MsgPublishBO publishMaMessage(@RequestBody MsgMaPublishParamBO publishParamBO);
}
